<template>
	<view>
		<view class="nav">
			<uni-icons class="icon" type="back" size="30" @click="back"></uni-icons>
			<view class="nav-title">
				<text>发布帖子</text>
			</view>
		</view>
		<!-- 内容 -->
		<view class="content">
			<view class="content-box">
				输入帖子标题&内容
			</view>
			<view class="content-photograph">
				<uni-icons type="plusempty" size="50"></uni-icons>
				<view class="text">
					照片
				</view>
			</view>
			<view class="location">
				<uni-icons type="location"></uni-icons>
				<view class="">
					默认定位
				</view>
			</view>
		</view>
		<!-- 标签分类 -->
		<view class="">
			<block v-if="isShow">
				<view class="biaoqian">
					<view class="left">
						<uni-icons type="settings" size="24"></uni-icons>
						<view class="">
							标签分类
						</view>
					</view>
					<view class="right">
						<uni-icons type="forward" size="24" @click="isShow = false"></uni-icons>
					</view>
				</view>
			</block>
			<block v-else>
				<view class="biaoqian" v-for="item,index in 6" :key="index">
					<view class="left">
						<uni-icons type="settings" size="24"></uni-icons>
						<view class="">
							话题
						</view>
					</view>
					<view class="right">
						<uni-icons v-if="index == 0" type="bottom" size="24" @click="isShow = true"></uni-icons>
					</view>
				</view>
			</block>
		</view>
		<!-- 底部发布按钮 -->
		<view class="fabu-box">
			<button class="fabu-btn" @click="open">发布</button>
		</view>
		<!-- 发布成功弹窗 -->
		<uni-popup ref="popup" type="bottom">
			<uni-card>
				<view class="card-box">
					<view class="">
						<h1>发布成功</h1>
					</view>
					<view class="">
						可在我的发布中查看详情
					</view>
					<uni-icons type="closeempty" size="24" @click="onClick"></uni-icons>
				</view>
			</uni-card>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isShow:true
			};
		},
		methods: {
			// 打开弹窗
			open() {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				this.$refs.popup.open('center')
			},
			// 跳转到互动
			onClick() {
				uni.switchTab({
					url:'/pages/interact/index'
				})
				this.$refs.popup.close()
			},
			back() {
				uni.navigateBack(1)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.nav{
		margin-top: 40rpx;
		font-size: 36rpx;
		display: flex;
	}
	.nav-title{
		margin-left: 240rpx;
	}
	.content {
		width: 100%;
		padding: 40rpx;
		border-bottom: 1rpx solid #ccc;

		.content-box {
			height: 200rpx;
		}

		.content-photograph {
			position: sticky;
			width: 200rpx;
			height: 200rpx;
			border: 1rpx dashed #ccc;
			font-size: 40rpx;

			.uniui-plusempty[data-v-a2e81f6e]:before {
				position: absolute;
				top: 60rpx;
				left: 50rpx;
			}

			.text {
				position: absolute;
				top: 130rpx;
				left: 60rpx;
			}
		}

		.location {
			display: flex;
			width: 200rpx;
			margin-top: 40rpx;
			border: 1rpx solid #ccc;
			border-radius: 30rpx;
		}
	}

	.biaoqian {
		display: flex;
		justify-content: space-between;
		padding: 0 40rpx;
		line-height: 80rpx;
		border-bottom: 1rpx solid #ccc;

		.left {
			display: flex;

			.uniui-settings[data-v-a2e81f6e]:before {
				margin-right: 10rpx;
			}
		}
	}

	.fabu-box {
		position: fixed;
		bottom: 0;
		width: 100%;
		border-top: 1rpx solid #ccc;
		border-radius: 15rpx;
		padding: 20rpx 0 40rpx;

		.fabu-btn {
			width: 50%;
			margin: 0 auto;
			border: 1rpx solid #ccc;
			border-radius: 30rpx;
			font-size: 30rpx;
		}
	}
	.card-box {
		position: relative;
		width: 630rpx;
		padding: 100rpx 0;
		h1 {
			font-weight: 400;
			margin-bottom: 40rpx;
		}
		view {
			width: 100%;
			text-align: center;
			color: #000;
			font-size: 24rpx;
		}
		.uniui-closeempty[data-v-a2e81f6e]:before {
			position: absolute;
			top: 0;
			right: 0;
		}
	}
</style>
